package com.manner.groupon.controller.staff;

import com.manner.groupon.common.BaseResponse;
import com.manner.groupon.common.ResultUtils;
import com.manner.groupon.model.dto.linkman.StaffAddLinkmanRequest;
import com.manner.groupon.model.vo.LinkmanLoadStoreListVo;
import com.manner.groupon.model.vo.StaffHomeData;
import com.manner.groupon.service.store.StoreLinkManService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Manner
 * @Description: 平台内部员工联系人操作请求控制器
 * @DateTime: 2024/11/10 14:54
 */
@RestController
@RequestMapping("/staff/linkman")
@RequiredArgsConstructor
public class StoreLinkmanController {

    private final StoreLinkManService storeLinkManService;

    /**
     * @param staffPhone 员工手机账号
     * @return BaseResponse<StaffHomeData>
     * @description: 加载后台员工的主页数据
     * @author Manner
     * @date 2024/12/11 18:45
     */
    @GetMapping("/load-home-data/{phone}")
    public BaseResponse<StaffHomeData> loadStaffBackstageHomeData(@PathVariable("phone") String staffPhone) {
        return ResultUtils.success(storeLinkManService.loadStaffHomeData(staffPhone));
    }

    /**
     * @return BaseResponse<StoreLinkMan>
     * @description: 内部员工邀请线下店铺门店入驻平台, 创建商户门店联系人信息
     * @author Manner
     * @date 2024/11/10 14:58
     */
    @PutMapping("/share")
    public BaseResponse shareInvitation(@RequestBody StaffAddLinkmanRequest staffAddLinkmanRequest) {
        storeLinkManService.addStoreLinkMan(staffAddLinkmanRequest);
        return ResultUtils.success("联系人信息添加成功!");
    }
}
